<?php

/**
 * 广告平台
 *
 * @author Ciro <ciro.han@shangbox.com>
 * @copyright 2011-2012 shangbox.com
 * $Id: Public.php 162 2012-11-09 04:04:30Z Jun.Lu.726@gmail.com $
 * @history 2011-2012  ::  Ciro  ::  Create File
 */
class Helper_Public
{

    function __construct()
    {
        ;
    }

    //生成唯一标识符
    //sha1()函数， "安全散列算法（SHA1）"
    static public function create_unique()
    {
        $data = $_SERVER['HTTP_USER_AGENT'] . $_SERVER['REMOTE_ADDR'] . time() . rand();
        return sha1($data);
    }

    /**
     * 生成密码
     * @param type $passwd
     * @return type
     */
    static public function create_passwd($passwd)
    {
        return md5("adhengyi" . md5($passwd));
    }

    /**
     * app key secret
     */
    static public function cretae_appKeySecret()
    {
        $data = array("key"           => "", "secret"        => "");
        $data["key"]    = substr(time() . rand() . time(), 0, 11);
        $data["secret"] = substr(md5(md5(time() . rand())), 0, 20) . rand(1000000, 10000000);
        return $data;
    }

    function __destruct()
    {
        ;
    }

}

?>
